package com.itheima.day09泛型和二叉树.练习;

import java.util.Collections;
import java.util.TreeSet;

/*某it公司项目组总共有8名开发人员，分别是：
"SMITH"、"MARTIN"、"ALLEN"、"SCOTT"、"TURNERS"、"KING"、"MILLER"、"JONES"
项目经理SMITH为了让大家能够快速相互认识，所以决定让团队人员都做一个自我介绍，自我介绍的顺序是：名字越
短越先自我介绍，名字长度一致，那么就按字符串的自然顺序自我介绍。*/
public class Demo2 {
    public static void main(String[] args) {
        String[] strs={"SMITH","MARTIN","ALLEN","SCOTT","TURNERS","KING","MILLER","JONES"};
        TreeSet<String> set=new TreeSet<String>((String s1,String s2)->{
            int x=s1.length()-s2.length();
            return s2.length()-s1.length()==0?s1.compareTo(s2):x;
        });
        Collections.addAll(set,strs);
        System.out.println(set);

    }
}
